function t_popup__trapFocus(t){var e=t.querySelectorAll('a, button, input:not([type="hidden"]):not(.js-form-spec-comments), select, textarea, embed, video, iframe, [tabindex="0"]'),o=e[0],p=e[e.length-1];document.addEventListener("keydown",(function(t){if(document.body.classList.contains("t-body_popupshowed")){var e="Tab"===t.key||9===t.keyCode,n;(e||e&&t.shiftKey)&&(t.shiftKey&&document.activeElement.classList.contains("t-popup_show")&&p.focus(),"Tab"!==t.key||t.shiftKey||document.activeElement!==p||(t.preventDefault(),o.focus()),"Tab"===t.key&&t.shiftKey&&document.activeElement===o&&(t.preventDefault(),p.focus()))}}))}function t_popup__addAttributesForAccessibility(t){var e=document.querySelectorAll('a[href="'+t+'"]');Array.prototype.forEach.call(e,(function(t){t&&(t.setAttribute("role","button"),t.setAttribute("aria-haspopup","dialog"))}))}function t_popup__resizePopup(t){var e=document.getElementById("rec"+t);if(e){var o=e.querySelector(".t-popup__container");if(o){var p=getComputedStyle(o,null),n=parseInt(p.paddingTop)||0,r=parseInt(p.paddingBottom)||0,s=o.clientHeight-(n+r),u=120,c=Number(e.getAttribute("data-record-type")),a,i=1093===c||121===c&&e.querySelector(".t1093");364!==c&&365!==c||(u=30),(868===c||331===c||358===c||1013===c||746===c||i)&&(u=0),s>window.innerHeight-u?o.classList.add("t-popup__container-static"):o.classList.remove("t-popup__container-static")}}}function t_popup__showPopup(t){t&&(t.style.display="block"),setTimeout((function(){t.focus();var e=t?t.querySelector(".t-popup__container"):null;e&&e.classList.add("t-popup__container-animated"),t&&t.classList.add("t-popup_show"),t_onFuncLoad("t_popup__trapFocus",(function(){t_popup__trapFocus(t)}))}),50)}function t_popup__closePopup(t){var e=document.querySelector(".t-popup.t-popup_show"),o=t.querySelector(".t-popup__container");if(t===e){var p=document.body;p.dispatchEvent(new CustomEvent("popupHidden")),p.classList.remove("t-body_popupshowed"),p.classList.remove("t-quiz__body_popupshowed")}t.classList.remove("t-popup_show"),o.style.removeProperty("transition"),o.classList.remove("t-popup__container_no-transform"),setTimeout((function(){var t;document.querySelectorAll(".t-popup:not(.t-popup_show)").forEach((function(t){t.style.display="none"}))}),300),t_popup__addFocusOnTriggerButton()}function t_popup__addClassOnTriggerButton(t,e){var o=document.querySelectorAll(".t-popup__triggered-btn");Array.prototype.forEach.call(o,(function(t){t.classList.remove("t-popup__triggered-btn")})),t.addEventListener("keydown",(function(t){if(13===t.keyCode){var o=t.target,p=!!o.closest('a[href="'+e+'"]')&&o;if(!p)return;window.isMobile||p.classList.add("t-popup__triggered-btn")}}))}function t_popup__addFocusOnTriggerButton(){var t=document.querySelector(".t-popup__triggered-btn");t&&(t.focus(),t.classList.remove("t-popup__triggered-btn"))}Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.msMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.webkitMatchesSelector||Element.prototype.oMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(t){for(var e=this;e&&1===e.nodeType;){if(Element.prototype.matches.call(e,t))return e;e=e.parentElement||e.parentNode}return null});